import { req_info_music_audio_upload } from '../../Classes/cla_req_info_upload_music_audio';
import {
  get_file_path_cur_audio,
  get_file_path_cur_audio_time,
} from './Func/get_file_path_cur_audio';

import fs from 'fs-extra';

/**
 * 记录 音频 文件 信息
 * @param cur_info
 * @param file
 */
export function set_file_music_audio_upload(
  cur_info: req_info_music_audio_upload,
  file: Express.Multer.File
) {
  let file_buffer = file.buffer;

  let file_path = get_file_path_cur_audio(cur_info);

  let file_path_time = get_file_path_cur_audio_time(cur_info);

  fs.outputFile(file_path, file_buffer);

  fs.outputFile(file_path_time, file_buffer);
}
